<template>
  <div>
        <el-table
          :data="capital"
          border
          style="width: 100%">
          <el-table-column v-for="(item,index) in capitalTit" :key="index"
            :prop="item.prop"
            :label="item.label"
            :min-width="item.width">
          </el-table-column>
        </el-table>
        <div style="margin: 30px 0;">
          <el-pagination
          @current-change="handleCurrentChange"
          :page-size="pageSize"
          layout="prev, pager, next, jumper"
          :total="total">
          </el-pagination>
        </div>
  </div>
</template>
<script>
export default {
  data() {
    return {
      id:this.$route.params.id,
      capitalTit:[{
          prop:'AvailableAmount',
          label:'可用金额',
          width: '180'
        },{
          prop:'fbdje',
          label:'变动金额',
          width: '180'
        },{
          prop:'fbdSM',
          label:'变动说明',
          width: '180'
        },{
          prop:'fbdtype',
          label:'变动类型',
          width: '180'
        },{
          prop:'InvestmentAmount',
          label:'再投金额',
          width: '180'
        },{
          prop:'tDate',
          label:'记录时间',
          width: '180'
        },{
          prop:'TotalAmount',
          label:'累计投资金额',
          width: '180'
        }
      ],
      capital:[],
      total: 0,
      pageSize: 20,
    }
  },
  methods: {
    handleCurrentChange(val) {
       this.getTableDate(val)
    },
    getTableDate (page) {
      this.$get(this,{api:'member/loadExperienceMoney.do',data: {
        fUid:this.id,
        pageSize: this.pageSize,
        page
      }
      }).then(({data})=>{
        if (data.state === 0) {
          if (page == 1) {
            this.total = data.content[0];
          }
          //变动类型（｛0：获取，1：使用，3：过期，4：回款，5：投资未实名收益作废｝）
          data.content[1].forEach(function(obj) {
             if (obj.fbdtype == 0)  obj.fbdtype="获取"
             if (obj.fbdtype == 1)  obj.fbdtype="使用"
             if (obj.fbdtype == 3)  obj.fbdtype="过期"
             if (obj.fbdtype == 4)  obj.fbdtype="回款"
             if (obj.fbdtype == 5)  obj.fbdtype="投资未实名收益作废"
          }, this);
          this.capital = data.content[1];
        } else {
          this.$toast({
            message: data.message
          })
        }
      })
    }
  },
  mounted () {
    this.getTableDate(1);
  }
}
</script>


